<?php
include 'functions.php';
function upLoad() {
		p($_FILES);
	//循环$_FILES以后name名叫什么都无所谓，因为直接取的是$v
	foreach ($_FILES as $v) {
		p($v);
		foreach ($v as $key => $value) {
			p($value);
			foreach ($value as $k => $va) {
				p($k);
				if (IS_POST) {
					if (is_uploaded_file($v['tmp_name'][$k])) {
						$type = ltrim(strrchr($v['name'][$k], '.'), '.');
						//文件名
						$fileName = time() . mt_rand(0, 99999) . '.' . $type;
						//上传目录
						$path = './Upload/' . date('ymd');
						is_dir($path) || mkdir($path, 0777, true);
						//完整路径
						$fullPath = $path . '/' . $fileName;
						//移动临时文件到新的位置，其实就是上传
						move_uploaded_file($v['tmp_name'][$k], $fullPath);
					}
				}
			}
		}
	}
}
upLoad();
?>
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<title>Document</title>
	</head>
	<body>
		<form action="" method="post" enctype="multipart/form-data">
			文件1：
			<input type="file" name="upfiles[]" id="" />
			<br />
			文件2：
			<input type="file" name="upfiles[]" id="" />
			<br />
			<input type="submit" value="上传"/>
		</form>
	</body>
</html>